Validate AI Model
Used to validate an AI model's API configuration by testing the connection to the model provider. This ensures that the model credentials and configuration are correct before using it in production.
API Endpoint
| Property | Value |
|---|---|
| Request Method | POST |
| Request URL | https://api.seliseblocks.com/models/{model_id}/validate |
Request
Request Example
curl -X POST 'https://api.seliseblocks.com/models/model_123/validate?project_key=YOUR_PROJECT_KEY' \
-H 'accept: application/json'
Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| model_id | string | Yes | The unique identifier of the model to validate. |
Query Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| project_key | string | No | The project key for your project. |
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
| accept | string | Yes | Accepted response format. Use application/json |
tip
When to validate your AI model:
- After initial model creation to verify configuration
- Before deploying to production environment
- After updating API keys or credentials
- When troubleshooting connection issues
- After changing provider settings or base URLs
- Periodically to ensure continued connectivity
The validation process:
- Tests authentication with the provider's API
- Verifies the model exists and is accessible
- Checks API quota and rate limits
- Validates custom headers and parameters
- Confirms base URL connectivity
- Returns detailed error messages for debugging
Response
Success Response (200 OK)
Returns an object containing the validation results.
{
"is_valid": true,
"provider": "openai",
"model_name": "gpt-4-turbo-preview",
"connection_status": "successful",
"api_version": "v1",
"timestamp": "2025-01-12T10:30:00Z"
}
Response Fields
| Field | Type | Description |
|---|---|---|
| is_valid | boolean | Indicates whether the model configuration is valid. |
| provider | string | The AI model provider name. |
| model_name | string | The specific model name being validated. |
| connection_status | string | Status of the connection test (e.g., "successful", "failed"). |
| api_version | string | The API version being used. |
| timestamp | string | ISO 8601 timestamp of the validation. |
note
Response Object Structure
The actual response structure may vary based on the provider. The response returns a flexible object (additionalProp1: {}) that can contain provider-specific validation details such as:
- Model availability status
- API endpoint health
- Quota information
- Supported features
- Provider-specific metadata
Error Response (422 Unprocessable Entity)
Returns validation error details when the model configuration is invalid or the connection test fails.
{
"detail": [
{
"loc": [
"path",
"model_id"
],
"msg": "Model not found or invalid model ID",
"type": "value_error.notfound"
}
]
}
Error Response Fields
| Field | Type | Description |
|---|---|---|
| detail | array | Array of validation error objects. |
| loc | array | Location of the error in the request (e.g., path, query). |
| msg | string | Human-readable error message. |
| type | string | Error type identifier. |
Common Validation Failures
| Failure Type | Description | Resolution |
|---|---|---|
| Invalid API Key | API key is incorrect, expired, or revoked | Update model with valid API key |
| Model Not Found | Model ID doesn't exist in the system | Verify model_id is correct |
| Connection Timeout | Cannot reach provider's API endpoint | Check network connectivity and base_url |
| Authentication Failed | Provider rejected the credentials | Verify API key permissions and account status |
| Quota Exceeded | API usage limits reached | Upgrade plan or wait for quota reset |
| Invalid Configuration | Missing required provider-specific fields | Check Azure deployment_name or other required fields |
| Provider Unavailable | Model provider service is down | Wait and retry, or check provider status page |
Error Codes
| Status Code | Description | Response Type |
|---|---|---|
| 200 | OK - Model configuration is valid | Success |
| 400 | Bad Request - Invalid request format | Bad Request |
| 401 | Unauthorized - Invalid API credentials | Unauthorized |
| 404 | Not Found - Model ID doesn't exist | Not Found |
| 422 | Validation Error - Model configuration invalid | Unprocessable Entity |
| 503 | Service Unavailable - Provider API unavailable | Service Unavailable |
warning
Important Considerations
- Validation tests make actual API calls to the provider, which may count against your quota
- Some providers charge for validation requests
- Validation does not guarantee all model features will work, only basic connectivity
- Failed validation prevents the model from being used in AI agents
- Always validate after updating model credentials or configuration
- Keep validation frequency reasonable to avoid unnecessary API costs